type dir_t = anyptr

type dirent_t = struct {
    u64 ino
    u64 off
    u16 reclen
    u16 namlen
    u8 t
    [u8;1024] name
}

#linkid 'opendir'
fn opendir(anyptr str):dir_t

#linkid 'readdir'
fn readdir(dir_t d):rawptr<dirent_t>

#linkid closedir
fn closedir(dir_t d):int